<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table,td{
            border: 1px solid palegreen;
            border-collapse: collapse;
        }
    </style>
</head>
<body>
    <table>

    </table>
    <script>
        var table1 = document.querySelector('table')
        class Tab {
            constructor (n,m) {
                this.n = n
                this.m = m
            }
            shop () {
                console.log(this.m,this.n)
                var str = ''
                for(var i=0;i<this.n;i++){
                    str += '<tr>'
                    for(var j=0;j<this.m;j++){
                        str += '<td>'+j+'</td>'
                    }
                    str += '</tr>'
                }
                table1.innerHTML = str
            }
        }
        var table = new Tab(3,4)
        table.shop()
    </script>
</body>
</html>